package com.myhexin.producer.service;

import com.myhexin.model.UserBean;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

/**
 * @author Jayce
 * @version 1.0.0
 * @date 2021/10/7
 * @desc
 */
@Slf4j
@DubboService
public class UserServiceImpl implements UserService {
    @Override
    public String sayHelo(String msg) {
        log.info(msg);
        return "hello " + msg;
    }

    @Override
    public String login(UserBean userBean) {
        if (userBean == null || userBean.getUsername() == null || userBean.getPassword() == null) {
            return "parameters error.";
        } else if (userBean.getUsername().equals("jinyan") && userBean.getPassword().equals("123456")) {
            return "Welcome: " + userBean.getUsername();
        }

        return "Login failed.";
    }
}
